package com.ws.shop.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ws.shop.dao.AccessoryDao;
import com.ws.shop.entity.Accessory;
import com.ws.shop.service.AccessoryService;
@Service(value="accessoryService")
public class AccessoryServiceImpl implements AccessoryService {
	@Resource(name="accessoryDao")
	private AccessoryDao accessoryDao;

	@Transactional(rollbackFor=Exception.class)
	public Object[] saveOrUpdate(Accessory accessory) {
		return accessoryDao.saveOrUpdate(accessory);
	}

	@Transactional(rollbackFor=Exception.class)
	public void deleteById(int id) {
		accessoryDao.deleteById(id);
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public Accessory findAccessoryById(int id) {
		return accessoryDao.findAccessoryById(id);
	}
	
	public List<Accessory> getAccessoryByRelationId(long relationid){
		return accessoryDao.getAccessoryByRelationId(relationid);
	}
	
	public int winersayUpimg(final long uid,final long oid,final long  accessoryid){
		return accessoryDao.winersayUpimg(uid, oid, accessoryid);
	}
}
